package com.environment_pro.monitor.servlet;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.quartz.SchedulerException;

import com.environment_pro.monitor.service.TbSystemJobService;
import com.environment_pro.monitor.util.StaticUtil;

public class SystemInitServlet extends javax.servlet.http.HttpServlet implements
		javax.servlet.Servlet {
	
	private static final Logger logger = Logger.getLogger(SystemInitServlet.class);

	/**
	 * 
	 */
	private static final long serialVersionUID = 7372868713898072162L;

	public void init(ServletConfig config) {
		try {
			//初始化轮训任务
			TbSystemJobService tbSystemJobService = (TbSystemJobService) StaticUtil.getBean("tbSystemJobService");
			tbSystemJobService.initSchedulerJob();
			logger.info("Servlet init complete");
		} catch (SchedulerException e) {
			e.printStackTrace();
		}
	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
	}

}
